import { http, lazy, defineRouteConfig } from 'src/utils';
import { FeatureErrorBoundary } from 'src/feature-antd';
import Forms from './forms';
import type { Method } from 'axios';

export const SignIn = defineRouteConfig({
  path: '/sign-in',
  lazy: lazy(() => import('./element')),
  errorElement: <FeatureErrorBoundary />,
  action: async ({ request }) => {
    const data = await request.json();
    return await http.request({
      url: Forms.action,
      method: Forms.method as Method,
      data,
    });
  },
});

export default SignIn;
